import React from 'react';
import PropTypes from 'prop-types';
import { Form, Input } from 'antd';
import Line from './Line';

const { Item } = Form;
const { TextArea } = Input;

// 前直属上级确认申请
const Ceo = ({ form, isEdit, relatedBusinessObject }) => {
    const { getFieldDecorator } = form;
    const { suggestionCeo } = relatedBusinessObject;
    return (
        <div>
            <Line />
            <h3>CEO确认</h3>
            <Item label="意见或建议" help={isEdit && '0-200个字符'}>
                {isEdit ? getFieldDecorator('suggestionCeo', {
                    initialValue: relatedBusinessObject.suggestionCeo,
                    rules: [
                        {
                            max: 200,
                            message: '0-200个字符'
                        }
                    ]
                })(
                    <TextArea placeholder="请输入" rows={4} />
                ) : (suggestionCeo || '无')}
            </Item>
        </div>
    )
};

Ceo.propTypes = {
    isEdit: PropTypes.bool.isRequired,
    form: PropTypes.object.isRequired,
    relatedBusinessObject: PropTypes.object.isRequired
};

export default Ceo;
